<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	response.setContentType("text/html;charset=UTF-8");
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String path = request.getContextPath();
%>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>嘉华金融后台管理中心</title>
<link rel="stylesheet" href="<%=path%>/admin/css/pintuer.css">
<link rel="stylesheet" href="<%=path%>/admin/css/admin.css">
<script src="<%=path%>/admin/js/jquery.js"></script>
</head>
<bodystyle="background-color:#f2f9fd;>
	<div class="header bg-main">
  		<div class="logo margin-big-left fadein-top">
   	 		<h1>
   	 		<!-- <img src="images/y.jpg" class="radius-circle rotate-hover" height="50" alt="" /> -->
   	 		嘉华金融后台管理中心</h1>
 	 	</div>
	  	<div class="head-l"><a class="button button-little bg-blue" href="javascript:void(0);" onclick="updatePassword()" ><span class="icon-power-admit"></span> 修改密码</a>&nbsp;&nbsp; <a class="button button-little bg-red" href="<%=path %>/devops/logout.html"><span class="icon-power-off"></span> 退出登录</a></div>
	</div>
	<div class="leftnav">
	  <div class="leftnav-title"><strong><span class="icon-list"></span>菜单列表</strong></div>
	  <c:forEach items="${bResources}" var="item" varStatus="vs">
	    <a href="<%=path %>${item.url}" target="right"><h2>${item.name}</h2></a>
	  </c:forEach>
	</div>
	<script type="text/javascript">
		$(function(){
			  $(".leftnavh2").click(function(){
				  $(this).next().slideToggle(200);	
				  $(this).toggleClass("on"); 
			  })
			  $(".leftnavul li a").click(function(){
				    $("#a_leader_txt").text($(this).text());
			  		$(".leftnavullia").removeClass("on");
					$(this).addClass("on");
			  })
		});
	</script>
	<div class="admin">
	   <iframe scrolling="auto" rameborder="0" src="" name="right" width="100%" height="100%"></iframe>
	</div>
</body>
<script type="text/javascript" src="<%=path%>/admin/js/layer/layer.js" ></script>
<link rel="stylesheet" href="<%=path %>/admin/css/tanchu.css">
<script type="text/javascript">
var seeHtml='';
var ht =$(window).height();
function op(seeHtml){
	layer.open({
		  type: 1,
		  skin: 'layui-layer-rim', //加上边框
		  area: ['1060px', ht+'px'], //宽高
		  content: seeHtml
		});
}
$(window).bind('onunload',function(){
	$.ajax({ 
		type:"get",
		url:"<%=path %>/admin/logout",
		data:none,
		dataType: "json",  
        timeout: 10000,  
        cache: false,  
        error: function(){
        	alert("系统忙...");
        },
        success: function(data){}
	});
	alert("goout");
});
var layerIndex = 0;
function updatePassword(){
	var uppass = '<div  style="margin:auto;width:250px;">'
		+'<div style="height:45px;margin-top:10px;" ><div style="float:left;height:45px;line-height:45px;" ><label>原密码：</label></div><div style="float:left;" ><input id="lastPassword" class="input w50" type="text" name="lastPassword" /></div></div>'
		+'<div style="height:45px;margin-top:10px;" ><div style="float:left;height:45px;line-height:45px;"><label>新密码：</label></div><div style="float:left;" ><input id="newPassword" class="input w50" type="text" name="newPassword" /></div></div>'
		+'<div style="height:45px;width:132px;margin:10px auto;" ><button class="button bg-main icon-check-square-o" type="button" onclick="javascript:subPass();">确认修改</button></div>'
	+'</div>';
	layerIndex = layer.open({
			  type: 1,
			  skin: 'layui-layer-rim', //加上边框
			  area: ['430px', '260px'], //宽高
			  content: uppass
			});
}
var nowPassword = '${sessionScope.admin.adPassword}';
function subPass(){
	var lastPassword = $('#lastPassword').val().trim();
	var newPassword = $('#newPassword').val().trim();
	var id = '${sessionScope.admin.adId}';
	if(nowPassword!= lastPassword){
		layer.alert('原密码错误，请重新输入！');
		$('#lastPassword').val('');
	}else if(newPassword==""){
		layer.alert('新密码不能为空');
	}else if(newPassword==nowPassword){
		layer.alert('新密码与原密码相同');
		$('#newPassword').val('');
	}else{	
    	layer.close(layerIndex);
		$.ajax({
			type:'post',
			url:'<%=path %>/devops/updatePassword',
			data:{adId:id,newPassword:newPassword},
			dataType: "json",  
	        timeout: 10000,  
	        cache: false,  
	        error: function(){
	        	alert("系统忙...");
	        },
	        success: function(data){
	        	if(data= 1){
	        		layer.msg('密码修改成功');
	        		nowPassword = newPassword;
	        	}else if(data = -1){
	        		layer.msg('未能成功修改，请刷新重试');
	        	}
	        }
		});
	}
}
</script>
</html>